import { createRouter, createWebHashHistory, RouteRecordRaw } from 'vue-router';
import Home from '../views/home.vue';

const routes: RouteRecordRaw[] = [
    {
        path: '/',
        redirect: '/dashboard',
    },
    {
        path: '/',
        name: 'Home',
        component: Home,
        children: [
            {
                path: '/dashboard',
                name: 'dashboard',
                meta: {
                    title: '系统首页',
                    permiss: '1',
                },
                component: () => import(/* webpackChunkName: "dashboard" */ '../views/BasicPage/PlatformInfo.vue'),
            },
            {
                path: '/user',
                name: 'user',
                meta: {
                    title: '用户管理',
                    permiss: '2',
                },
                component: () => import(/* webpackChunkName: "table" */ '../views/BasicPage/UserManage.vue'),
            },
            {
                path: '/topic',
                name: 'topic',
                meta: {
                    title: '话题管理',
                    permiss: '3',
                },
                component: () => import(/* webpackChunkName: "charts" */ '../views/BasicPage/Topic.vue'),
            },
            {
                path: '/question',
                name: 'question',
                meta: {
                    title: '问题管理',
                    permiss: '3',
                },
                component: () => import(/* webpackChunkName: "form" */ '../views/BasicPage/Question.vue'),
            },
            {
                path: '/answer',
                name: 'answer',
                meta: {
                    title: '回答管理',
                    permiss: '3',
                },
                component: () => import(/* webpackChunkName: "tabs" */ '../views/BasicPage/Answer.vue'),
            }
        ],
    },
    {
        path: '/login',
        name: 'Login',
        meta: {
            title: '登录',
        },
        component: () => import(/* webpackChunkName: "login" */ '../views/login.vue'),
    }
];

const router = createRouter({
    history: createWebHashHistory(),
    routes,
});

export default router;